package com.hades.common.extend

import android.view.View
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder

fun <T, VH : BaseViewHolder> BaseQuickAdapter<T, VH>.addAllData(datas: MutableList<T>?) {
    datas?.run {
        addData(this)
    }
}


fun <T, VH : BaseViewHolder> BaseQuickAdapter<T, VH>.addItemType(block: BaseQuickAdapter<T, VH>.() -> Unit): BaseQuickAdapter<T, VH> {
    block()
    return this
}

fun <T, VH : BaseViewHolder> BaseQuickAdapter<T, VH>.onBindEvent(block: BaseQuickAdapter<T, VH>.(adapter:BaseQuickAdapter<*,*>, view: View, position:Int)->Unit): BaseQuickAdapter<T, VH> {
    setOnItemChildClickListener { adapter, view, position ->
        run {
            block(adapter, view, position)
        }
    }

    return this
}

class AdapterExt {
}